package fourmiefight.ihm;

import java.util.ArrayList;

import javax.swing.table.AbstractTableModel;

import fourmiefight.metier.Carte;
import fourmiefight.metier.Fourmiliere;
import fourmiefight.tools.ConcurrentArrayList;

@SuppressWarnings("serial")
public class FourmilliereTableModel extends AbstractTableModel{
	
	private Carte carte;
	
	private ArrayList<Fourmiliere> listeF;
	
	private String[] columnNames = {"Fourmilières", "Id"};
	
	public FourmilliereTableModel(Carte applicationController) {
		this.carte = applicationController;
		listeF = applicationController.getListeFourmiliere();
	}
	
	
	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return columnNames.length;
	}
	public String getColumnName(int column) {
		return columnNames[column];
	}

	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return listeF.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		switch (columnIndex) {
			case 0:
				// Nom
				return listeF.get(rowIndex).getNom();
			case 1:
				// Id
				return listeF.get(rowIndex).getIdd();
			default:
				throw new IllegalArgumentException();
		}
	}
	public boolean isCellEditable(int row, int col) {
		return false;
	}
}
